#import "EnhancedApp.h"
#import <defaults/defaults.h>
#import <sys/param.h>
#import <string.h>
#import <libc.h>

@implementation Application (EnhancedApp)

- (const char *) appDirectory
{
   static char appDirectory[MAXPATHLEN] = { '\0' };
   char *ptr;

   if(!appDirectory[0])
   {
      strcpy(appDirectory, NXArgv[0]);
      if(ptr = rindex(appDirectory, '/'))
	  *ptr = (char)0;

      if(appDirectory)
	  chdir(appDirectory);

      getwd(appDirectory);
   }

   return appDirectory;
}

@end

